using RabbitMQ.Client;

namespace Aurora.RabbitMq.Provider;

/// <summary>
/// channel accessor 
/// </summary>
public class ChannelAccessor : IChannelAccessor
{
    public void Dispose()
    {
        _disposeAction.Invoke();
    }

    public IModel Channel { get; }
    public string Name { get; }

    protected readonly Action _disposeAction;

    public ChannelAccessor(IModel channel, string name, Action disposeAction)
    {
        Channel = channel;
        Name = name;
        _disposeAction = disposeAction;
    }
}